home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJEMU106.ARJ / EMUINIT.S < prev    next >
Text File  |  1991-05-08  |  1KB  |  62 lines

  1. /*
  2. ** If this is a standalone build, the starting EIP must point to _emu387
  3. ** and go32 will install the interrupt vector itself.
  4. */
  5.     .data
  6.  
  7.     .comm    _eax,4
  8.     .comm    _ebx,4
  9.     .comm    _ecx,4
  10.     .comm    _edx,4
  11.     .comm    _esi,4
  12.     .comm    _edi,4
  13.     .comm    _ebp,4
  14.     .comm    _esp,4
  15.     .comm    _eip,4
  16.  
  17.     .text
  18.  
  19.     .globl    _emu387
  20. _emu387:
  21.     movl    %eax,_eax
  22.     movl    %ebx,_ebx
  23.     movl    %ecx,_ecx
  24.     movl    %edx,_edx
  25.     movl    %esi,_esi
  26.     movl    %edi,_edi
  27.     movl    %ebp,_ebp
  28.  
  29.     movl    %esp,_esp
  30.     add    $12,_esp
  31.     pushl    %ebp
  32.     movl    %esp,%ebp
  33.  
  34.     movl    4(%ebp),%eax
  35.     movl    %eax,_eip
  36.     call    _emu_entry__Fv
  37.     movl    _eip,%eax
  38.     movl    %eax,4(%ebp)
  39.     movl    _eax,%eax
  40.     movl    _ebx,%ebx
  41.     movl    _ecx,%ecx
  42.     movl    _edx,%edx
  43.     movl    _esi,%esi
  44.     movl    _edi,%edi
  45.     popl    %ebp
  46.     iret
  47.  
  48.     .globl    _emu_install__Fv
  49. _emu_install__Fv:
  50.     movw    $16,%ax
  51.     movw    %ax,%gs
  52.     movl    $_emu387,%ecx
  53.     movl    $56,%eax    /* vector 7 * 8 bpv */
  54.     movw    %cx,%gs:(%eax)
  55.     movw    $64,%gs:2(%eax)    /* selector 8 == 32-bit code */
  56.     movw    $0x8f00,%gs:4(%eax)
  57.     rorl    $16,%ecx
  58.     movw    %cx,%gs:6(%eax)
  59.     movw    %ds,%ax
  60.     movw    %ax,%gs
  61.     ret
  62.